How To Build FreeType for ARM


Intro


In this How To we are going to build FreeType 2.5.2 with our GCC/G++ 4.8.2 cross-compiler. I originally cross-compiled this as part of the GTK+ dependencies. I was actually doing ok until it came to cross-compiling GTK+ itself. That is when I came across AGAR :D Which is a better solution for me and worked out great because AGAR recommends to use FreeType.

Tar Balls


Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
  • freetype-2.5.2.tar.gz

Create a Workspace


I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
$ export FREETYPE_SRC=~/workbench/freetype/src
$ export FREETYPE_BUILD=~/workbench/freetype/build
$ mkdir -pv ~/workbench/freetype
$ mkdir $FREETYPE_SRC && mkdir $FREETYPE_BUILD
$ cd $FREETYPE_SRC

Gather the Sources


Now that we have a workspace created and we are currently in the src directory we can begin bringing down the sources and extracting them.

freetype

$ wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.2.tar.gz
$ tar -pxzf freetype-2.5.2.tar.gz

Build Environment


To make things a little smoother let's setup some environment variables:
$ export INSTALLDIR=~/workbench/gcc-g++-4.8.2/arm
$ export PATH=$INSTALLDIR/bin:$PATH
$ export TARGETMACH=arm-none-linux-gnueabi
$ export BUILDMACH=i686-pc-linux-gnu
$ export CROSS=arm-none-linux-gnueabi
$ export CC=${CROSS}-gcc
$ export LD=${CROSS}-ld
$ export AS=${CROSS}-as
$ export CXX=${CROSS}-g++
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change INSTALLDIR to point to your cross-compiler.

Build FreeType


$ cd ../build/
$ ../src/freetype-2.5.2/./configure --prefix=/home/<your user>/workbench/freetype/final --host=$TARGETMACH --without-png
$ make
$ make install

Output


cd into the final directory and output its contents:
$ cd ../final/
$ ls
You should have the following directories:
  • bin
  • include
  • lib
  • share

Lastly, move the contents of these directories, or the directories themselves if they do not already exist, to your custom Linux file system or dev board. For FreeType, the files should go under /usr.